package main

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"os"
)

func init() {
	if len(os.Args) != 2 {
		fmt.Println("Usage: ./example2 <url>")
		os.Exit(-1)
	}
}
func main() {
	// Get  a response
	// 21C 21c++ 21c# 21-shuj 21-suanf 21-wang
	// 21-coker
	// 21-k8s
	// 21-tcp
	//21-wng
	// 21-wimn
	// 21-linux
	// 21-data
	// 21-rnzhuli
	//21-jwehy
	//shuj+guanf+kaiy+kuangj+neihe+dic +neix+jis
	//diweju
	// 21-s
	//21-base
	r, err := http.Get(os.Args[1])
	if err != nil {
		fmt.Println(err)
		return
	}
	res, _ := ioutil.ReadAll(r.Body)
	var ret Response // {}
	json.Unmarshal(res, &ret)
	//io.Copy(os.Stdout,r.Body)
	if err := r.Body.Close(); err != nil {
		fmt.Println(err)
	}
	fmt.Println(ret)
}

type Response struct {
	Data     interface{} `json:"data"`
	Error    string      `json:"error"`
	ErrorMsg string      `json:"errorMsg"`
}
